from common.base_page import BasePage
from page_locators.userpage_locator import UserPageLocator as UPL


class UserPage(BasePage):

    def __init__(self, driver):
        super().__init__(driver)

    def click_userinfo(self):
        self.click(UPL.userinfo_link)

    def upload_headpic(self, file):
        self.click(UPL.preview_loc)
        self.sleep(2)
        self.intoframe(UPL.frame_loc)
        self.sleep(3)
        print(1)
        self.upload_file(UPL.file_loc, file)
        self.sleep(2)
        print(2)
        self.click(UPL.save_loc)
        self.sleep(2)
        print(3)
        self.outoframe()
        self.click(UPL.save_headpic_loc)

    def safe_quit(self):
        self.click(UPL.quit_loc)
